import numpy as np 

def load_data(seed=1984):
    np.random.seed(seed)
    N = 100 # 各类的样本数
    DIM = 2 # 数据的元素个数
    ClS_NUM = 3 # 类别数

    x = np.zeros((N*ClS_NUM,DIM))
    # print(f"x.shape:\n{x.shape}")
    # print(f"x[0]:\n{x[0]}")

    t = np.zeros((N*ClS_NUM,ClS_NUM),dtype=np.int32)
    # print(f"t.shape:\n{t.shape}")
    # print(f"t[0]:\n{t[0]}")

    for j in range(ClS_NUM): # 每个类别的处理
        for i in range(N): 
            rate = i/N
            radius = 1.0 * rate 
            theta = j*4.0 + 4.0*rate + np.random.randn()*0.2

            ix = N*j + i 
            x[ix] = np.array([radius*np.sin(theta),radius*np.cos(theta)]).flatten()
            t[ix,j] = 1
    return x,t